import axios from 'axios'
// 默认qq音乐数据
export function search(value,times) {

  const url = '/api/getSearchList'
  const data = {
    '_': 1570695995727,
    g_tk: 5381,
    uin: 0,
    format: 'json',
    inCharset: 'utf-8',
    outCharset: 'utf-8',
    notice: 0,
    platform: 'h5',
    needNewCode: 1,
    w: `${value}`,
    zhidaqu: 1,
    catZhida: 1,
    t: 0,
    flag: 1,
    ie: 'utf-8',
    sem: 1,
    aggr: 0,
    perpage: 20,
    n: 20,
    p: `${times}`,
    remoteplace: 'txt.mqq.all'
  }

  return axios( url, {
    params: data
  }).then((res) => {
    return Promise.resolve(res.data)
  })
}

//咪咕音乐数据
export function miguSearch(value,times) {
  const url = '/api/getMiguSearch'
  const data = {
    rows: 20,
    type: 2,
    keyword: value,
    pgc: times
  }
  return axios(url, {
    params: data
  }).then((res) => {
    return Promise.resolve(res.data)
  })
}